<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<div id='test'>
    <p id='start'>start</p>
    <p id='end'>end</p>
</div>
<script>
var range = document.createRange();
var start = document.getElementById('start');
var end = document.getElementById('end');
range.setStart(start.firstChild, 0);
range.setEnd(end.firstChild, 0);

shouldThrow("range.surroundContents(start)", '"InvalidStateError: Failed to execute \'surroundContents\' on \'Range\': The Range has partially selected a non-Text node."');

if (window.testRunner)
    document.getElementById('test').outerHTML = '';
</script>
</body>
</html>
